package com.example.turnoverwarning.job;

import com.example.turnoverwarning.service.AlertService;
import com.xxl.job.core.handler.annotation.XxlJob;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;

@Configuration
@EnableScheduling
public class ScheduleTask {

    private AlertService alertService;

    public ScheduleTask(AlertService alertService) {
        this.alertService = alertService;
    }

    // 每天23:30执行
//    @Scheduled( cron = "*/10 * * * * *")
    @XxlJob("dailySalesCheck")
    public void dailySalesCheck() {
        alertService.checkDailySalesAndAlert();
    }
}